<?php
include APPPATH . "views/tamchau/inc/meta.php";
include APPPATH . "views/tamchau/inc/background.php";
include APPPATH . "views/tamchau/inc/head.php";
?>
<link href="/libraries/ckeditor/contents.css" rel="stylesheet">
<script type='text/javascript'>
    var active_menu = "<?php echo $menu_active ?>";
	
	$(document).ready(function(){
		$('.event-content').hide();
		$('.event-content:first-child').show();
		if ($('#su-kien-boxs').length > 0){
	        $('#su-kien-boxs').niceScroll('#su-kien-boxs>div', {
	            cursoropacitymax: 0.4,
	            touchbehavior: true,
	            cursorborder: '0',
	            scrollspeed: 100,
	            bouncescroll: false,
	            horizrailenabled: false
	        });
	    }
		if($("#third-boxs").length>0){
			$("#third-boxs").niceScroll('#third-boxs>div',{
				cursor:'default',
				cursoropacitymax:0.8,
				cursoropacitymin:0.4,
				touchbehavior:true,
				cursorborder :'0',
				scrollspeed:100,
				bouncescroll:false,
				horizrailenabled:false,
				//autohidemode: false,
				cursorcolor:"#7F2286",
				cursorwidth :4,
				cursorborderradius :0
			});
		}
		$('.event-item').click(function (e) {
			$('.event-item').removeClass('active');
			$(this).addClass('active');
			$('#third-boxs,#su-kien-boxs').addClass('in-out');
			gotoEvent(this);
		})
		gotoEvent('.event-item:first-child');
	});
	function ddgoback(){
		$('#third-boxs,#su-kien-boxs').removeClass('in-out');
	}
	function gotoEvent($this){
		var eventid = $($this).data('eventid');
			$('.event-content').hide();
			$('.event-'+eventid).show();
			$('#third-boxs').getNiceScroll().resize();
			initgmap(
				$($this).data('lat'),
				$($this).data('lon'),
				$($this).data('title'),
				$($this).data('address')
			);
	}
</script>
<div id="su-kien-boxs" class="-main-container su-kien-boxs bg6">
	<div>
		<div style="padding:40px 40px 0 40px">
			<h1>SỰ KIỆN</h1>
			<div style="width:40px;height:1px;background:#636B38;margin:20px 0"></div>
		</div>
		<div>
			<?php 
			if($event_list){
				$f=0;
				foreach($event_list as $tmp){
					?>
			<div class='event-item' data-eventid="<?php echo ($tmp->_id) ?>">
				<h3><?php echo quotes_to_entities($tmp->_name) ?></h3>
				<div class="e-name">
					<span class="location-icon"></span>
					<?php echo quotes_to_entities($tmp->_address) ?>
				</div>
				<div class="e-phone">
					<span class="phone-icon"></span>
					<?php echo quotes_to_entities($tmp->_phone) ?>
				</div>
				<div class="e-date">
					<span class="fax-icon"></span>
					<?php echo quotes_to_entities($tmp->_fax) ?>
				</div>
				<div class="clear"></div>
			</div>
					<?php
				}
			}else echo 'No data to display';
			?>
		</div>
	</div>
</div>
<div id="third-boxs" class="-main-container third-boxs bg6">
	<div>
		<?php 
		if($event_list){

			foreach($event_list as $tmp){
				?>
		<div class='event-content event-<?php echo ($tmp->_id) ?>'>
			<img src="<?php echo ($tmp->_thumb) ?>" style="width:100%" />
			<div style="padding:40px">
				<h1><?php echo ($tmp->_name) ?></h1>
				<div class="cke_editable">
				
				<?php echo ($tmp->_content) ?>
				</div>		
			</div>
			<div style="text-align:center;padding-bottom:30px" class="visible-xs visible-sxs">
				<button  class="btn btn-default" type="button"
							onclick="ddgoback();"
						><span>Danh sách sự kiện</span></button>
			</div>
		</div>
				<?php
			}
		}else echo 'No data to display';
		?>
		
	</div>
</div>
<div class="clear"></div>
